home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib8 / v_10_09 / 1009102a < prev    next >
Encoding:
Text File  |  1995-11-01  |  302 b   |  27 lines

  1.  
  2. Listing 3
  3.  
  4. #include <iostream.h>
  5. #include <string.h>
  6.  
  7. class String
  8.     {
  9.     ...
  10. public:
  11.     String(const String &s);
  12.     ...
  13. private:
  14.     size_t len;
  15.     char *str;
  16.     };
  17.  
  18. String::String(const String &s)
  19.     {
  20.     len = s.len;
  21.     str = new char[len + 1];
  22.     strcpy(str, s.str);
  23.     }
  24.  
  25. ----------
  26.  
  27.